require 'watir'
include Watir
require 'test/unit'
require 'test/unit/ui/console/testrunner'
require 'watir/testUnitAddons'
require 'watir/testcase'
require 'watir/contrib/enabled_popup'

class TC_Admin < Test::Unit::TestCase
  def test_30
    $ie.goto($UniVar)
    $ie.refresh()
    $ie.refresh()
    
    $ie.link(:text, 'Control Panel').click
    $ie.link(:text, 'Administration').click
    $ie.table(:index, 9).click
    $ie.link(:index, 17).click
    $ie.text_field(:index, 2).value = "1"
    $ie.link(:text, 'Save').click 
    $ie.link(:text, 'Sign out').click
    $ie.link(:text, 'Join').click
    $ie.text_field(:index, 2).value = "g"
    $ie.text_field(:index, 3).value = "password"
    $ie.text_field(:index, 4).value = "password" 
    $ie.text_field(:index, 5).value = "password@telligent.com"
    $ie.text_field(:index, 6).value = "password@telligent.com"
    $ie.button(:id, /ctl00_bcr_ctl01_ctl00_CreateAccount/).click
    assert(!$ie.contains_text('Username must be at least 3 characters and no more than 64 characters.'))
    $ie.link(:text, 'Sign in').click
    
    $ie.text_field(:id, /username/ ).set($ADMIN)
    $ie.text_field(:id, /password/ ).set($PASSWORD)
    $ie.link(:id, /ctl00_bcr_ctl00_ctl03_loginButton/).click         
  end
end